package models;
 
import java.util.*;
import javax.persistence.*;
 
import play.data.binding.*;
import play.data.validation.*;
import play.db.jpa.*;
 
@Entity
public class Appliance extends Model {
    @Required
    public String title;
    
    @Required
    public String appVersion;
    
    @Required
    public String vaVersion;
    

    public Date postedAt;
    
    public String imageurl;       
    
    @Lob
    @Required
    @MaxSize(10000)
    public String content;
 
    @Required   
    @ManyToOne
    public User author;
    
    public Appliance(User author, String title, String content, String appVersion, String vaVersion) {
        this.author = author;
        this.title = title;
        this.content = content;
        this.postedAt = new Date();
        this.imageurl = "/public/images/lampd.png";
        this.vaVersion = vaVersion;
        this.appVersion = appVersion;
        
           }
    
    public void setpostedAt(Date postedAt) {
    	this.postedAt = new Date();
 
    }    
    
    public void setimageurl(String imageurl) {
    	if (imageurl.length() >= 1)       
        this.imageurl = imageurl;
    	else this.imageurl="/public/images/lampd.png";
  
    }
}
 



